package com.gateway.register.common.dto;

import com.gateway.common.enums.ApiHttpMethodEnum;
import com.gateway.register.common.type.DataType;
import com.gateway.register.common.type.DataTypeParent;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/1/27 21:42
 **/
public class MetaDataRegisterDTO implements DataTypeParent {

    /**
     * 应用id
     */
    private String appId;

    /**
     * 应用名
     */
    private String appName;

    /**
     * 环境变量
     */
    private String env;

    /**
     * 上下文路径
     */
    private String contextPath;

    /**
     * 类型
     */
    private String rpcType;

    /**
     * RequestMapping consume
     */
    private String consume;

    /**
     * RequestMapping produce
     */
    private String produce;

    /**
     * 请求路径
     */
    private String apiPath;

    /**
     * 服务id
     */
    private String serviceId;

    /**
     * http method
     */
    private ApiHttpMethodEnum apiHttpMethodEnum;

    /**
     * 全限定名
     */
    private String qualifiedName;

    /**
     * 方法名
     */
    private String methodName;

    /**
     * 描述
     */
    private String desc;

    /**
     * 是否添加前缀
     */
    private boolean addPrefixed;

    @Override
    public DataType getType() {
        return DataType.META_DATA;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public String getContextPath() {
        return contextPath;
    }

    public void setContextPath(String contextPath) {
        this.contextPath = contextPath;
    }

    public String getRpcType() {
        return rpcType;
    }

    public void setRpcType(String rpcType) {
        this.rpcType = rpcType;
    }

    public String getConsume() {
        return consume;
    }

    public void setConsume(String consume) {
        this.consume = consume;
    }

    public String getProduce() {
        return produce;
    }

    public void setProduce(String produce) {
        this.produce = produce;
    }

    public String getApiPath() {
        return apiPath;
    }

    public void setApiPath(String apiPath) {
        this.apiPath = apiPath;
    }

    public String getServiceId() {
        return serviceId;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public ApiHttpMethodEnum getApiHttpMethodEnum() {
        return apiHttpMethodEnum;
    }

    public void setApiHttpMethodEnum(ApiHttpMethodEnum apiHttpMethodEnum) {
        this.apiHttpMethodEnum = apiHttpMethodEnum;
    }

    public String getQualifiedName() {
        return qualifiedName;
    }

    public void setQualifiedName(String qualifiedName) {
        this.qualifiedName = qualifiedName;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public boolean getAddPrefixed() {
        return addPrefixed;
    }

    public void setAddPrefixed(boolean addPrefixed) {
        this.addPrefixed = addPrefixed;
    }

    public static final class Builder {
        private String appId;
        private String appName;
        private String env;
        private String contextPath;
        private String rpcType;
        private String consume;
        private String produce;
        private String apiPath;
        private String serviceId;
        private ApiHttpMethodEnum apiHttpMethodEnum;
        private String qualifiedName;
        private String methodName;
        private String desc;
        private boolean addPrefixed;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder appId(String appId) {
            this.appId = appId;
            return this;
        }

        public Builder appName(String appName) {
            this.appName = appName;
            return this;
        }

        public Builder env(String env) {
            this.env = env;
            return this;
        }

        public Builder contextPath(String contextPath) {
            this.contextPath = contextPath;
            return this;
        }

        public Builder rpcType(String rpcType) {
            this.rpcType = rpcType;
            return this;
        }

        public Builder consume(String consume) {
            this.consume = consume;
            return this;
        }

        public Builder produce(String produce) {
            this.produce = produce;
            return this;
        }

        public Builder apiPath(String apiPath) {
            this.apiPath = apiPath;
            return this;
        }

        public Builder serviceId(String serviceId) {
            this.serviceId = serviceId;
            return this;
        }

        public Builder apiHttpMethodEnum(ApiHttpMethodEnum apiHttpMethodEnum) {
            this.apiHttpMethodEnum = apiHttpMethodEnum;
            return this;
        }

        public Builder qualifiedName(String qualifiedName) {
            this.qualifiedName = qualifiedName;
            return this;
        }

        public Builder methodName(String methodName) {
            this.methodName = methodName;
            return this;
        }

        public Builder desc(String desc) {
            this.desc = desc;
            return this;
        }

        public Builder addPrefixed(boolean addPrefixed) {
            this.addPrefixed = addPrefixed;
            return this;
        }

        public MetaDataRegisterDTO build() {
            MetaDataRegisterDTO metaDataRegisterDTO = new MetaDataRegisterDTO();
            metaDataRegisterDTO.setAppId(appId);
            metaDataRegisterDTO.setAppName(appName);
            metaDataRegisterDTO.setEnv(env);
            metaDataRegisterDTO.setContextPath(contextPath);
            metaDataRegisterDTO.setRpcType(rpcType);
            metaDataRegisterDTO.setConsume(consume);
            metaDataRegisterDTO.setProduce(produce);
            metaDataRegisterDTO.setApiPath(apiPath);
            metaDataRegisterDTO.setServiceId(serviceId);
            metaDataRegisterDTO.setApiHttpMethodEnum(apiHttpMethodEnum);
            metaDataRegisterDTO.setQualifiedName(qualifiedName);
            metaDataRegisterDTO.setMethodName(methodName);
            metaDataRegisterDTO.setDesc(desc);
            metaDataRegisterDTO.setAddPrefixed(addPrefixed);
            return metaDataRegisterDTO;
        }
    }

    @Override
    public String toString() {
        return "MetaDataRegisterDTO{" +
                "appId=" + appId +
                ", appName='" + appName + '\'' +
                ", env='" + env + '\'' +
                ", contextPath='" + contextPath + '\'' +
                ", rpcType='" + rpcType + '\'' +
                ", consume='" + consume + '\'' +
                ", produce='" + produce + '\'' +
                ", apiPath='" + apiPath + '\'' +
                ", serviceId='" + serviceId + '\'' +
                ", apiHttpMethodEnum=" + apiHttpMethodEnum +
                ", qualifiedName='" + qualifiedName + '\'' +
                ", methodName='" + methodName + '\'' +
                ", desc='" + desc + '\'' +
                ", addPrefixed=" + addPrefixed +
                '}';
    }
}
